package com.leen.user.repository;


import com.leen.user.entity.YxUserBill;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

@Repository
public interface YxUserBillRepository extends CrudRepository<YxUserBill,Long>, JpaSpecificationExecutor<YxUserBill> {

    @Query(value="select count(*) from YxUserBill a where a.category like ?1")
    int findCategory(String category);

    @Query(value="select count(*) from YxUserBill a where a.type like ?1")
    int findType(String type);

    @Query(value="select count(*) from YxUserBill a where a.pm =?1")
    int findPm(Byte pm);

    @Query(value="from YxUserBill where createTime between :beginTime and :endTime")
    List<YxUserBill>findCreatTimeHQL(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
}
